package com.java.test;

public class Main {

    public static void main(String[] args) {
        sayNumber(20,4);
    }

    /**
     *personNum 人数
     startNumber 开始报的数 1
     */
    public static void sayNumber(int personNum,int startNumber){
        String currentNumStr;
        int i = 1;
        boolean remainder3,remainder5,remainder7;
        while(i <= personNum) {
            currentNumStr = String.valueOf(startNumber);
            if (currentNumStr.contains("3")) {
                System.out.println("第"+i+"个人,当前的数值是:"+currentNumStr +",say: Fizz");
                i++;
                startNumber++;
                continue;
            }
            remainder3 = startNumber % 3 == 0;
            remainder5 = startNumber % 5 == 0;
            remainder7 = startNumber % 7 == 0;
            //三个都是true
            if (remainder3 && remainder5 && remainder7) {
                System.out.println("第"+i+"个人,当前的数值是:"+currentNumStr+",say: FizzBuzzWhizz");
            } else if ((remainder3 && remainder5)
                    || (remainder3 && remainder7)
                    || (remainder5 && remainder7)) {
                //有一个false
                System.out.println("第"+i+"个人,当前的数值是:"+currentNumStr+",say: FizzBuzz");
            } else if (remainder3) {
                //有两个false ,其中 remainder3=true
                System.out.println("第"+i+"个人,当前的数值是:"+currentNumStr+",say: Fizz");
            } else if (remainder5) {
                //有两个false ,其中 remainder5=true
                System.out.println("第"+i+"个人,当前的数值是:"+currentNumStr+",say: Buzz");
            } else if (remainder7) {
                //有两个false ,其中 remainder7=true
                System.out.println("第"+i+"个人,当前的数值是:"+currentNumStr+",say: Whizz");
            } else {
                //三个都是false
                System.out.println("第"+i+"个人,当前的数值是:"+currentNumStr+",say: "+startNumber);
            }
            i++;
            startNumber++;
        }
    }

}
